const thisWeek = {
  text: '本周',
  onClick(picker) {
    const start = dayjs().startOf('week').add(1, 'day').format('YYYY-MM-DD');
    const end = dayjs().endOf('week').add(1, 'day').format('YYYY-MM-DD');
    picker.$emit('pick', [start, end]);
  }
}

const prevWeek = {
  text: '上周',
  onClick(picker) {
    const start = dayjs().startOf('week').add(1, 'day').subtract(7, 'day').format('YYYY-MM-DD');
    const end = dayjs().endOf('week').add(1, 'day').subtract(7, 'day').format('YYYY-MM-DD');
    picker.$emit('pick', [start, end]);
  }
}

const nextWeek = {
  text: '下周',
  onClick(picker) {
    const start = dayjs().startOf('week').add(8, 'day').format('YYYY-MM-DD');
    const end = dayjs().endOf('week').add(15, 'day').format('YYYY-MM-DD');
    picker.$emit('pick', [start, end]);
  }
}

const thisMonth = {
  text: '本月',
  onClick(picker) {
    const start = dayjs().startOf('month').format('YYYY-MM-DD');
    const end = dayjs().endOf('month').format('YYYY-MM-DD');
    picker.$emit('pick', [start, end]);
  }
}

const prevMonth = {
  text: '上月',
  onClick(picker) {
    const start = dayjs().startOf('month').subtract(1, 'month').format('YYYY-MM-DD');
    const end = dayjs(start).endOf('month').format('YYYY-MM-DD');
    picker.$emit('pick', [start, end]);
  }
}

const nextMonth = {
  text: '下月',
  onClick(picker) {
    const start = dayjs().startOf('month').add(1, 'month').format('YYYY-MM-DD');
    const end = dayjs(start).endOf('month').format('YYYY-MM-DD');
    picker.$emit('pick', [start, end]);
  }
}

export { prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth }